<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style/admin.css" />
<link rel="stylesheet" type="text/css" href="style/global.css" />
<link rel="stylesheet" type="text/css" href="style/tip.css" />
<script language="javascript" type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
<title>咨询反馈</title>
<style type="text/css">
.pointer{
	cursor:pointer;
}
</style>
</head>

<body>
	<div id="wrap">
    	<div id="public_head"></div>
        <div class="m_search">
        <form action='' method='post'>
                按科室<select class="select" name="dep">
            <?php 
            	if(is_array($allDep)&&count($allDep)>0){
            		echo '<option value=0>所有科室</option>';
            		foreach ($allDep as $k=>$v){
            ?>
        		<option value='<?php echo $k?>' <?php if($k==$dep)echo 'selected';?>><?php echo $v;?></option>
        	<?php 
            		}
            	}else{
            		echo '<option value=0>您还没有加入科室</option>';
            	}
        	?>
        	</select> 
                咨询人<input class="qi_text" name="men" type="text" value="<?php echo $men;?>"/> 
                起止时间 <input class="Wdate" type="text" name='bt' value="<?php echo $begtime;?>" onClick="WdatePicker()"> 
            > <input class="Wdate" type="text" name='et' value="<?php echo $endtime;?>" onClick="WdatePicker()"> 
            咨询状态<select class="select" name="state">
            	<option value='0'>所有状态</option>
            	<option value='1'<?php if(1==$state)echo ' selected';?>>未回复</option>
            	<option value='2'<?php if(2==$state)echo ' selected';?>>已回复</option>
            	<option value='3'<?php if(3==$state)echo ' selected';?>>审核未通过</option>
            	<option value='4'<?php if(4==$state)echo ' selected';?>>审核通过</option>
            	<option value='5'<?php if(5==$state)echo ' selected';?>>未审核</option>
            </select> 
                    类型<select class="select" name="type">
                    <option value='0'>所有类型</option>
                    <option value='1'<?php if(1==$type)echo ' selected';?>>公开</option>
                    <option value='2'<?php if(2==$type)echo ' selected';?>>内部公开</option>
          </select> 
          <input class="btn_search" name="sub_sel" type="submit" value="" />
          </form>
        </div>
        <div class="m_content">
        	<table class="qi_table" width="0" border="0" cellpadding="0" cellspacing="1">
              <tr><th>姓名</th><th>问题标题</th><th>科室</th><th>提问时间</th><th>回复时间</th><th >回复人</th><th>状态</th><th>是否可见</th><th>操作</th></tr>
              <?php 
              	if(is_array($allconsult) && count($allconsult)>0){
              		foreach ($allconsult as $v){
              ?>
              <tr>
              	<td><?php echo str_replace($men, "<font color=red><b>".$men."</b></font>&nbsp;", $v['NAME'])?></td>
              	<td style="text-align:left;"><?php echo $v['TITLE']?></td>
              	<td><?php echo $allDep[$v['DEP_NO']]?></td>
              	<td><?php echo $v['ASK_TIME']?></td>
              	<td><?php echo $v['UPD_TIME']?$v['UPD_TIME']:'<font color="#EF9024" pid="'.$v['ASK_ID'].'" class="goanswer pointer">待回复</font>'?></td>
              	<td><?php echo $v['UPD_USER']?ATools::retUserTrueName($v['UPD_USER']):'<font color="#EF9024" pid="'.$v['ASK_ID'].'" class="goanswer pointer">待回复</font>'?></td>
              	<td><b class="greenword">
					<?php 
						switch ($v['STATE']) {
							case '1':echo '<font color="red">未回复</font>';break;
							case '2':echo '<font color="gray">已回复</font>';break;
							case '3':echo '<font color="blue">审核未通过</font>';break;
							case '4':echo '<font color="orange">审核通过</font>';break;
							case '5':echo '<font color="red">未审核</font>';break;
							default:echo '';break;
						}
					?>
				</b></td>
              	<td>
					<?php 
						switch ($v['TYPE']){
							case '1':echo '公开';break;
							case '2':echo '内部公开';break;
							default:echo '';break;
						}
					?>
				</td>
              	<td>
              		<?php if($v['STATE']!=5){?>
	              		<a href="?c=demo&a=zixunlist" pid="<?php echo $v['ASK_ID']?>" class="goanswer pointer">回复</a> 
	              	<?php }else{?>
	              		<a href="/index.php?c=feed&a=lookask&id=<?php echo $v['ASK_ID']?>" onclick="T.setCookie('goback_ask','<?php echo $_SERVER['REQUEST_URI']?>')">查看</a> 
	              	<?php }?>
	              	<a href="" class="pass" passid='4' pid="<?php echo $v['ASK_ID']?>"><font color='gray'>通过</font></a> 
	              	<a href="" class="pass" passid='3' pid="<?php echo $v['ASK_ID']?>"><font color='gray'>不通过</font></a>
	              	<a href="?c=feed&a=editask&id=<?php echo $v['ASK_ID']?>"><font color='gray'>编辑</font></a>
	              	<a href="?c=feed&a=delask&id=<?php echo $v['ASK_ID']?>"  onclick="if(T.confirm('确认删除吗？')){return true;}else{return false;}"><font color='gray'>删除</font></a>
	              </td>
              </tr>
              <?php 
              		}
              	}else{
              ?>
              <tr height="40"><td style="text-align:center;color:green;" colspan='10'>没有您搜索的结果</td></tr>
              <?php }?>
              <tr><td colspan='10'>
					<?php 
						$url = '/index.php?c='.$_REQUEST['c'].'&a='.$_REQUEST['a'].'&p=_num_&dep='.$dep.'&men='.urlencode($men).'&bt='.$begtime.'&et='.$endtime.'&state='.$state.'&type='.$type;
						echo JYTools::pager($url,$tolNum,$page,$pagesize);
					?>
			  </td></tr>
              <tr><!--<td colspan="10"><div class="page">共 36 条记录</div><div class="pageTurn"><a href="">首页</a> <a href="">上一页</a> 1/3页 <a href="">下一页</a> <a href="">尾页</a> 转到第<input class="text" name="" type="text" />页 <a href="">GO</a></div><div class="clear"></div></td>--></tr>
            </table>
        </div>
    </div>
</body>
</html>
<script src="/js/xheditor/jquery/jquery-1.4.4.min.js"></script>
<script src="/js/boot.js"></script>
<script src="/js/tip.js"></script>
<script src="/js/add_public_head.js" type="text/javascript"></script>
<script type="text/javascript">
$('.pass').click(function (){
	var t = this
	if(T.confirm('确认操作吗？')){
		$.ajax({
			url:'/index.php',
			data:{'c':'feed','a':'pass','p':$(t).attr('passid'),'id':$(t).attr('pid')},
			type:'get',
			dataType:'json',
			success:function(de){
				T.addtip(t,lang[de.msg]);
				location.reload()
			}
		})
	}
	return false;
})
$('.goanswer').click(function(){
	T.setCookie('goback_ask','<?php echo $_SERVER['REQUEST_URI']?>')
	var gourl = '/index.php?c=feed&a=zixunList&id='+$(this).attr('pid')
	document.location.href=gourl
	return false;
})
$('input[name="sub_sel"]').click(function(){
	var now = new Date();
    var year = now.getFullYear();       //年
    var month = now.getMonth() + 1;     //月
    if(month<10){
		month = '0'+month
    }
    var day = now.getDate();  
    var nowday = year+'-'+month+'-'+day;
	if($('input[name="et"]').val() < $('input[name="bt"]').val()){
		alert('结束日期不能小于开始日期')
		return false;
	}
	if($('input[name="et"]').val() > nowday){
		alert('结束日期不能大于当天日期')
		return false;
	}
	return true;
})
</script>